package com.jlboot;

import com.jfinal.server.undertow.UndertowServer;
import com.jlboot.config.AppConfig;
import lombok.extern.slf4j.Slf4j;


/**
 * Created by 51594 on 2023/3/7.
 */
@Slf4j
public class App {

    public static void main(String[] args) {

        // Undertow
        // Undertow 是为嵌入而生的 Web Server，web.xml 已被抛弃，所以无法通过 web.xml 配置 web 组件。
        UndertowServer undertow = UndertowServer.create(AppConfig.class);
        undertow.configWeb((builder) ->{
                builder.addFilterUrlMapping("jfinal", "/*");
            }
        );

        // undertow.onDeploy((classLoader, deploymentInfo) -> {
        //// deploymentInfo.insertFilterUrlMapping(0, "shiro", "/*",
        // DispatcherType.REQUEST);
        // for (FilterMappingInfo fm : deploymentInfo.getFilterMappings()) {
        // System.out.println(fm.getFilterName());
        // }
        // });

        // 禁用 HTTP TRACE / TRACK Methods

        undertow
                .addHotSwapClassPrefix("cn.dev33.satoken.jfinal.")
                .start();
    }

}
